package com.bianmaba.examples.controller.order;

import com.bianmaba.examples.bean.authorization.User;
import com.bianmaba.examples.bean.order.Order;
import com.bianmaba.examples.service.authorization.user.IUserService;
import com.bianmaba.examples.service.order.IOrderService;
import com.bianmaba.spring.data.jpa.domain.PageableRequest;
import com.bianmaba.spring.mvc.controller.ReadController;
import com.bianmaba.spring.mvc.method.support.annotations.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * @program: bianmaba-web-framework-extends
 * @description:订单业务层
 * @author: Chenjiabin
 * @create: 2018-04-21 11:45
 **/
@RestController
@RequestMapping(value = {"order"})
public class OrderController extends ReadController<Order, String> {

    @Autowired
    private IOrderService service;

    @Override
    protected IOrderService getService() {
        return service;
    }

    @JSON
    @RequestMapping("/query_by_sql")
    public List<Order> queryBySql() {
        return service.getRepository().executeSqlQuery("select * from `order`", Order.class);
    }
}
